<template>
  <view>
    <page-head title="form"></page-head>
    <view class="uni-padding-wrap">
      <view class="title"> 为了给您提供更优质的服务</view>
      <view style="height: 20upx"></view>
      <view class="title"> 邀请您对本次服务满意度打分</view>
      <view style="height: 60upx"></view>
      <uni-rate
        color="#AAA"
        margin="20"
        size="36"
        v-model="rateValue"
        @change="onChange"
      />
      <view style="height: 60upx"></view>
      <button @click="submit" type="primary">确认提交</button>
    </view>
  </view>
</template>
<script>
import { mapState } from "vuex";
export default {
  data() {
    return {
      rateValue: 1,
      IsdependRemote: "N",
      aid: "",
    };
  },
  onLoad(opt) {
    if (opt.aid) this.aid = opt.aid;
    console.log("###########aid", this.aid);
  },
  computed: {
    ...mapState(["openid"]),
  },
  methods: {
    async submit() {
      let data = { aid: this.aid, rate: this.rateValue };
      try {
        let res = await this.$request("Service/FinishSession", data, "post");
        if (res.data.data["Ask"]) {
          await this.$confirmOnly("非常感谢您的支持!");
          uni.redirectTo({
            url: "/pages/index/index",
          });
        }
      } catch (e) {
        this.$alert("提交问题描述失败");
      }
      console.log("############", this.rateValue);
    },
    onChange(e) {
      console.log(e);
    },
  },
};
</script>

<style>
.title {
  color: #777;
  letter-spacing: 2px;
}
.uni-form-item .title {
  padding: 0 28upx 0 0;
}
.uni-padding-wrap {
  background: #eee;
  margin: 40% 0 0 0;
  padding: 20upx 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.uni-common-mt {
  margin-top: 30rpx;
}
.uni-column {
  /* flex-direction: column; */
  align-items: center;
}
.uni-column-b {
  flex-direction: column;
  /* align-items: center; */
}
.uni-input {
  height: 50rpx;
  padding: 15rpx 25rpx;
  line-height: 50rpx;
  font-size: 28rpx;
  background: #fff;
  flex: 1;
}
.uni-textarea {
  /* height: 50rpx; */
  padding: 25rpx 25rpx;
  line-height: 50rpx;
  font-size: 28rpx;
  width: 93%;
  background: #fff;
  /* flex: 1; */
}
.uni-form-item {
  display: flex;
  width: 100%;
  padding: 10rpx 0;
}
.uni-btn-v {
  padding: 10rpx 0;
}
.uni-btn-v button {
  margin: 20rpx 0;
}
</style>
